import pickle
from flask import jsonify
from flask import Flask

app = Flask(__name__)
@app.route("/")
def service():
    with open("./result_keep.txt",'r') as file:
        result = file.read()
    results = result.strip("\n").split("\n")
    results = [i.split(";") for i in results ]
    results =[[int(i[0]),eval(i[1])] for i in results]
    results =results[-20:]
    results.sort(key=lambda x: (x[0]), reverse=True)
    face_result = {"person_count": results[0][0], "name_list": results[0][1]}
    return jsonify(face_result)

if __name__ == "__main__":
    app.run('0.0.0.0',port=5000)

